﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class SanPham : System.Web.UI.Page
{
    string keyword;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            keyword = Request["sanpham"];
            string sql = "SELECT SP.* FROM SANPHAM SP JOIN LOAISANPHAM LSP ON SP.LOAISANPHAM = LSP.MALOAISANPHAM WHERE LSP.TENLOAI = @SANPHAM";
            DataTable sanpham = Database.GetData(sql, "@SANPHAM", keyword);
            DataList1.DataSource = sanpham;
            DataList1.DataBind();
        }
    }
    public void BuyProduct(object sender, EventArgs e)
    {
        ImageButton image = (ImageButton)sender;
        String ProductID = image.CommandArgument;

        Response.Redirect("Muahang.aspx?sanpham=" + ProductID);
    }
    protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    public void Buy(object sender, EventArgs e)
    {
        LinkButton image = (LinkButton)sender;
        String ProductID = image.CommandArgument;

        Response.Redirect("Muahang.aspx?sanpham=" + ProductID);
    }
}